# 更改文件名称
import os
import shutil


path01 = '/Users/jiangce/Desktop/标记/03/'
path01label = '/Users/jiangce/Desktop/标记/03label/'
format_img = '.jpg'
format_xml = '.xml'
list01 = os.listdir(path01)
list01label = os.listdir(path01label)
num = 1

for item01 in list01:
    name_pic = item01.split('.')[0]
    path_img = path01 + item01
    os.rename(path_img, path01 + str(num)+format_img)
    for item01label in list01label:
        name_xml = item01label.split('.')[0]
        if name_xml == name_pic:
            path_xml = path01label + item01label
            os.rename(path_xml, path01label + str(num) + format_xml)
            break;
    num = num+1






